1. Field of the Invention
The present invention relates to an image reading device that optically reads an image on an original such as photographic film by irradiating light onto the original and a storage medium that stores a control procedure implemented on the image reading device. More specifically, the present invention relates to an image reading device provided with an autofocus mechanism that uses an infrared light to achieve an accurate read of the image on the original and a storage medium that stores a control procedure to be implemented on the image reading device.
2. Related Art
Image reading devices known in the art include film scanners that read film images obtained through a photographing operation performed by a camera. A film scanner reads an image on negative film or reversal film and transmits image data obtained to a host computer such as a personal computer or to an image processing device having an image display function.
In an image reading device, the positional relationship between the surface of the original and the reading optical system that reads the original changes in correspondence to the characteristics of the original. The characteristics of the original include, for instance, the thickness of the original and the warpage (curling) of the film original. The change in the relative positions described above causes a focal displacement at the reading optical system. Namely, due to the focal displacement occurring at the reading optical system, the image reading device cannot form an accurate image at the light-receiving surface of the image-capturing element such as a CCD line sensor which reads the original image. As a result, the image reading device cannot output high quality image data.
For this reason, in order to obtain high quality image data, the image reading device must be provided with an autofocus mechanism that adjusts the position of the reading optical system relative to the original to an optimal position.
In the prior art, autofocus in an image reading device is implemented as follows.
Autofocusing is normally implemented near the center of the original. Thus, the image reading device moves the reading optical system to position it near the center of the original. The reading optical system is moved by a scanning mechanism which moves the optical system along the subscanning direction.
The image reading device performs positioning to achieve a positional relationship between the original and the optical system so that they are at predetermined initial positions (e.g., positions at which the distance between the optical system and the original is at a maximum). This positioning to the initial positions is implemented by a focusing mechanism.
Next, the image reading device starts up an illuminating device to emit light in R (red), G (green) or B (blue). In response, the image-capturing element reads an image corresponding to one line (along the main scanning direction). It is to be noted that the design specifications of the reading optical system determine the optimal color light among R (red), G (green) and B (blue).
The image reading device then engages in main scanning to read an image corresponding to one line (along the main scanning direction). In other words, the image-capturing element at the image reading device receives the light having been transmitted through the original at a plurality of pixels and outputs a plurality of sets of image data, each indicating the intensity of the light received at one of the plurality of pixels. In this connection, the image-capturing element at the image reading device converts the light that has been received to image data and outputs the image data in units of a plurality of pixels corresponding to one line.
When the image data corresponding to the one line have been output, the image reading device detects a contrast value based upon the image data and stores the value. The contrast value is obtained by ascertaining absolute values, each representing the difference between the sets of image data corresponding to two adjacent pixels and then adding up the absolute values representing the differences.
Next, the focusing mechanism at the image reading device changes the positional relationship between the original and the reading optical system by a specific distance (hereafter referred to as the distance corresponding to one step). For instance, the focusing mechanism may change the positional relationship between the original and the reading optical system by reducing the distance therebetween by the distance corresponding to one step. The image reading device again engages in the operation for obtaining the contrast value explained above after the positional relationship between the original and the reading optical system has been changed.
The image reading device repeats the operations to change the distance between the original and the reading optical system by a distance corresponding to one step in their positional relationship and to obtain the contrast value under the current positional relationship until the original and the reading optical system reach a predetermined positional relationship.
Subsequently, the image reading device compares the contrast values obtained in correspondence to the individual positional relationships and determines the position at which the contrast value is the largest to set it as the focused position.
FIG. 30 shows an example of image data for one line obtained at a defocused position (non-focused position) by employing a CCD line sensor as the image-capturing element. In FIG. 30, the horizontal axis represents the pixel columns at the CCD line sensor and the vertical axis represents the output value of the image data output by the CCD line sensor. In this example, points corresponding to approximately 500 pixels are represented along the horizontal axis.
FIG. 31 presents image data for one line obtained at the focused position by employing a CCD line sensor as the image-capturing element. The relationship between the vertical axis and the optical axis in FIG. 31 is the same as that in FIG. 30.
As shown in FIG. 30, the output values from adjacent pixels at the CCD line sensor differ from each other only to a small degree at the defocused position. Thus, the contrast value at the defocused position is small.
As shown in FIG. 31, the output values from adjacent pixels at the CCD line sensor fluctuate greatly at the focused position. As a result, the contrast value at the focused position is large.
FIG. 32 presents an example of the change in the distance in increments of one step as mentioned earlier (the horizontal axis) and the change in the contrast value (the vertical axis). The values along the horizontal axis represent the number of pulses supplied to the stepping motor (part of the focusing mechanism) which drives the optical system in the focusing direction. In this example, the stepping motor moves the optical system to the measuring position which is one step ahead in response to a supply of four pulses. In addition, FIG. 32 illustrates changes in the contrast value occurring under visible light (any of R, G and B) as do FIGS. 30 and 31.
The image reading device compares the contrast values shown in FIG. 32 and determines the position (along the horizontal axis) with the largest contrast value as the focused position. After fixing the focused position at the focus position with the largest contrast value as described above, the image reading device repeats reading one line along the main scanning direction with the CCD line sensor and moving the reading optical system along the sub-scanning direction with the scanning mechanism. Through this process, the image reading device reads the image on the original by scanning the entire surface of the original.
Autofocusing implemented in the image reading device in the prior art described above poses the following problems.
First, in the image reading device in the prior art, a plurality of contrast values are obtained by changing the positional relationship between the original and the reading optical system by one step at a time. In such a case, if the plurality of contrast values thus obtained vary only to a small degree among themselves, it is difficult to detect the focused position.
For instance, if the image on the original shows a night scene or a starry sky, the individual sets of image data corresponding to the individual lines output by the image-capturing element will indicate small values on the whole. As a result, the relative difference among the contrast values each obtained by the image reading device by reading image data for one line under a specific positional relationship between the original and the reading optical system achieved by changing the positional relationship by one step is small. Thus, it is difficult to determine the focused position.
FIG. 33 illustrates a specific instance of the problem discussed above. FIG. 33 presents an example of a film original upon which a comet in a night sky has been photographed. In FIG. 33, the white line extending diagonally represents the comet. The image reading device sets a position around the center of the film original in FIG. 33 as the autofocus position.
FIG. 34 presents image data for one line obtained at a defocused position (non-focused position) by reading the image shown in FIG. 33 with a CCD line sensor constituting the image-capturing element. The relationship between the vertical axis and the horizontal axis in FIG. 34 is the same as that in FIG. 30. As illustrated in FIG. 34, the image data for one line at the defocused position indicate a high level of brightness over the image area corresponding to the comet and indicate a low level of brightness in other areas.
FIG. 35 presents image data for one line obtained at the focused position by reading the image shown in FIG. 33 with a CCD line sensor constituting the image-capturing element. The relationship between the vertical axis and the horizontal axis in FIG. 35 is the same as that in FIG. 34. As illustrated in FIG. 35, the image data for one line at the focused position indicate a high level of brightness over the image area corresponding to the comet and indicate a low level of brightness in the other areas. Consequently, the difference between the contrast value at the focused position and contrast value at the defocused position (non-focused position) is extremely small in the case of an image such as that shown in FIG. 33.
FIG. 36 illustrates the relationship between the change in the distance made in units of single steps (the horizontal axis) and the change in the contrast value (the vertical axis) with regard to the image shown in FIG. 33. The relationship between the vertical axis and the horizontal axis in FIG. 36 is the same as that in FIG. 32.
The image reading device compares the contrast values and determines the position (along the horizontal axis) with the largest contrast value as the focused position. However, the image reading device may make an erroneous decision with respect to the contrast value peak position if the contrast values vary only to a small degree as shown in FIG. 21. This results in a problem in that the image reading device may make an error in determining the focused position.
Secondly, in autofocusing achieved in the image reading device in the prior art, it is difficult to detect the focused position located in an area where the composition of the image on the original changes drastically.
Namely, a slight mechanical displacement may cause the focusing mechanism, which moves the optical system by one step, to set the optical system at a position which is offset along the sub-scanning direction, resulting in the optical system aligning with the original at the offset position. In this case, since the composition of the image drastically changes from, for instance, bright to dark, the contrast changes radically. For this reason, the correct contrast peak position cannot be detected and, instead, an erroneous contrast peak position is detected. This leads to a problem in that the image reading device in the prior art detects an erroneous focused position.